<!--  -->
<template>
  <div class="test5">
    <Form ref="form" :formData="formData" @submit="onSumbit"></Form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formData: []
    };
  },
  components: {},
  created() {
    let data = {
      user_id: 1,
      uid: "cmsf85362f5-bb10-8171-b154-b1f287ff386b",
      page: 1,
      limit: 10
    };

    this.$req.post(this.$api.userFormList, data).then(res => {
    });
    this.$req
      .post(this.$api.userFormInfo, {
        uid: "cmsf85362f5-bb10-8171-b154-b1f287ff386b"
      })
      .then(res => {
        this.formData = res.data.user_form_map;
        this.$req
          .post(this.$api.webUserFormInfo, { id: 10502 })
          .then(res => {
            this.$refs.form.data = res.data.user_commit_json;
          });
      });
    this.$req.post(this.$api.webUserFormList, data).then(res => {
    });
  },
  methods: {
    onSumbit(res) {
      let data = {
        user_id: 1,
        uid: "cmsf85362f5-bb10-8171-b154-b1f287ff386b",
        data: res.data,
        form_name: "测试表单"
      };
      this.$req.put(this.$api.addWebUserForm, data).then(res => {
      });
    }
  }
};
</script>
<style lang='scss' scoped>
.test5 {
  width: 500px;
  margin: 0 auto;
}
</style>